/**
 * @file ws2812Task.c
 * @brief WS2812 LED control task
 * @author TuxMonkey (nqx2004@gmail.com)
 * @version 1.0
 * @date 2025-07-08
 * 
 * @copyright Copyright (c) 2025  DLMU-C.ONE
 * 
 * @par 修改日志:
 * <table>
 * <tr><th>Date       <th>Version <th>Author  <th>Description
 * <tr><td>2025-07-08 <td>1.0     <td>TuxMonkey     <td>内容
 * </table>
 */
/*---------------------INCLUDES----------------------*/
#include "ws2812Task.h"
#include "ws2812.h"
#include "cmsis_os.h"
#include "tim.h"
#include "delayticks.h"

/*---------------------VARIABLES---------------------*/
uint8_t r = 0;
uint8_t g = 0;
uint8_t b = 0;

/*---------------------FUNCTIONS---------------------*/
/**
 * @brief WS2812 LED control task
 * @param  argument
 */
void ws2812Task(void const * argument)
{
	while (1)
	{
	    // WS2812_Ctrl(r, g, b);
        // r++;
        // g += 5;
        // b += 10;

        r=0;g=255;b=0;//绿色
        WS2812_Ctrl(r, g, b);
        delay_ticks(500); // 使用延时函数代替osDelay，避免任务切换失败
        r=0;g=0;b=255;//蓝色
        WS2812_Ctrl(r, g, b);
        delay_ticks(500);
        r=0;g=255;b=255;//青色
        WS2812_Ctrl(r, g, b);
        delay_ticks(500);
        r=255;g=255;b=0;//黄色
        WS2812_Ctrl(r, g, b);
        delay_ticks(500);
        r=255;g=0;b=255;//紫色
        WS2812_Ctrl(r, g, b);
        delay_ticks(500);

        // r=255;g=255;b=255;
        // WS2812_Ctrl(r, g, b);
        // delay_ticks(1000);
        // osDelay(1);
        // osDelay(100);
        osDelay(10);//每个任务最后都要写在while里，要不然会导致任务切换失败
	}
	
}
      
    
